package com.myproject.sbp.apollo.controller;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 情况一
 * 第二种方式，测试
 * @author ywh
 */
@RestController
public class ApolloController2 {

    /**
     * 方式二
     */
    @ApolloConfig
    private Config config;

    @ResponseBody
    @GetMapping("/config")
    public Object config(){
        return config.getProperty("name", "defaultValue");
    }

}